// i.d(t, { Z: () => a })
import Logger from "./Logger"
import browserUtil from "./browser.util"
declare global {
  interface Navigator {
    xr: any
  }
}
const r = new Logger("vr-platform-select")
const canXR = () => {
  const e = "xr" in navigator && "isSessionSupported" in navigator.xr && "requestSession" in navigator.xr
  return window.isSecureContext && e
}
export default {
  isSessionSupported: async (e = "immersive-vr") => {
    let t = !1
    if (canXR())
      try {
        t = await navigator.xr.isSessionSupported(e)
      } catch (e) {
        r.info("WebXR disabled", e)
      }
    r.debug(`WebXR session type: ${e} supported: ${t}`)
    return t
  },
  likelySupportsControllers: () => window.isSecureContext && (browserUtil.isOculus() || !browserUtil.isMobile()),
  apiExists: canXR
}
